<?php

namespace app\dic;

/**
 * 订单表
 */
class DicOrder
{
    /**
     *  订单状态=>未结算
     */
    public static $status_open = 'open';
    /**
     *  订单状态=>已关闭
     */
    public static $status_closed = 'closed';
    /**
     *  订单状态=>已取消
     */
    public static $status_cancelled = 'cancelled';
    /**
     *  订单状态=>任意订单
     */
    public static $status_any = 'any';

    /**
     * 订单状态
     */
    public static function  get_status($id = '', $isarray = false)
    {
        $array = [
            self::$status_open   => '未结算',
            self::$status_closed   => '已关闭',
            self::$status_cancelled   => '已取消',
            self::$status_any   => '任意订单',
        ];
        return $isarray ? $array : (isset($array[$id]) ? $array[$id] : '');
    }


    /**
     *  发货状态=>已发货
     * 
     */
    public static $fulfillment_status_shipped = 'shipped';
    public static $fulfillment_status_fulfilled = 'fulfilled';


    /**
     *  发货状态=>部分发货
     * 
     */
    public static $fulfillment_status_partial = 'partial';

    /* 
     *   发货状态=>显示尚未发货的订单
     */
    public static $fulfillment_status_unshipped = 'unshipped';
    /**
     *  发货状态=>显示任何履行状态的订单
     */
    public static $fulfillment_status_any = 'any';
    /**
     *  发货状态=>未完成
     */
    public static $fulfillment_status_unfulfilled = 'unfulfilled';

    /**
     * 发货状态
     */
    public static function  get_fulfillment_status($id = '', $isarray = false)
    {
        $array = [
            self::$fulfillment_status_shipped   => '已发货',
            self::$fulfillment_status_partial   => '部分发货',
            self::$fulfillment_status_unshipped   => '尚未发货',
            self::$fulfillment_status_any   => '任意订单',
            self::$fulfillment_status_unfulfilled   => '未完成',
            self::$fulfillment_status_fulfilled  => '已发货',
        ];
        return $isarray ? $array : (isset($array[$id]) ? $array[$id] : '');
    }

    /**
     * 财务状况=>授权订单
     */
    public static $financial_status_authorized = 'authorized';

    /**
     * 财务状况=>挂单
     */
    public static $financial_status_pending = 'pending';


    /**
     * 财务状况=>已付款
     */
    public static $financial_status_paid = 'paid';

    /**
     * 财务状况=>部分已付款
     */
    public static $financial_status_partially_paid = 'partially_paid';


    /**
     * 财务状况=>已退款
     */
    public static $financial_status_refunded = 'refunded';

    /** 
     * 财务状况=>无效订单
     */
    public static $financial_status_voided = 'voided';

    /**
     * 财务状况=> 部分退款
     */
    public static $financial_status_partially_refunded = 'partially_refunded';

    /**
     * 财务状况=>任何订单
     */
    public static $financial_status_any = 'any';

    /**
     * 财务状况=> 授权和部分支付的订单
      
     */
    public static $financial_status_unpaid = 'unpaid';

    /**
     * 财务状况=>自定义=>授权未完成
      
     */
    public static $financial_status_unfulfilled = 'unfulfilled';


    /**
     * 财务状况
     */
    public static function  get_financial_status($id = '', $isarray = false)
    {
        $array = [
            self::$financial_status_authorized   => '启用',
            self::$financial_status_pending   => '停用',
            self::$financial_status_paid   => '已取消',
            self::$financial_status_partially_paid   => '任意订单',
            self::$financial_status_refunded   => '任意订单',
            self::$financial_status_voided    => '任意订单',
            self::$financial_status_partially_refunded    => '任意订单',
            self::$financial_status_any    => '任意订单',
            self::$financial_status_unpaid   => '任意订单',
        ];
        return $isarray ? $array : (isset($array[$id]) ? $array[$id] : '');
    }


    /**
     * 订单操作=>更新订单
     */
    public static $type_2 = 2;
    /**
     * 订单操作=>获取订单
     *      
     * */
    public static $type_3 = 3;
    public static $type_4 = 4;


    /**
     * 成本对接=>未对接
     */
    public static $ismaterial_0 = 0;
    /**
     * 成本对接=>对接成功
     *      
     * */
    public static $ismaterial_1 = 1;

    /**
     * 成本对接=>对接失败
     */
    public static $ismaterial_2 = 2;
    /**
     * 成本对接=>未找到订单
     *      
     * */
    public static $ismaterial_3 = 3;
}
